//
//  MSGLogInViewController.m
//  QuickCure1
//
//  Created by apple on 2016/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "MSGLogInViewController.h"
#import "MSGLogInView.h"
#import "ForgetPassWordViewController.h"
#import "RegisterViewController.h"

@interface MSGLogInViewController ()

@end

@implementation MSGLogInViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}


- (void)setupUI{
    self.title = @"短信验证登录";
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    __weak MSGLogInViewController *selfVC = self;
    
    MSGLogInView *msgView = [MSGLogInView getMSGView];
    
    msgView.CompleteBlock = ^(Users *us){
        if (selfVC.CompleteBlock) {
            selfVC.CompleteBlock(us);
        }
        
        [selfVC.navigationController popViewControllerAnimated:YES];
    };
    [self.view addSubview:msgView];
    [msgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_topLayoutGuideBottom);
        make.leading.bottom.trailing.equalTo(self.view);
    }];
    
#pragma mark - 注册button被点击的监听通知
    [msgView addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventValueChanged];
    
}


#pragma mark
#pragma mark - button被点击的监听方法
- (void)clickButton:(MSGLogInView *)msgView{
    
    NSInteger tag = msgView.index;
    switch (tag) {
        case 1:
            NSLog(@"点击了-->注册验证码登录");
            [self.navigationController popViewControllerAnimated:YES];
            break;
        case 2:
        {
            NSLog(@"点击了-->注册新账号");
            RegisterViewController *registerVC = [[RegisterViewController alloc]init];
            [self.navigationController pushViewController:registerVC animated:YES];
        }
            break;
        case 3:
        {
            NSLog(@"点击了-->忘记密码");
            ForgetPassWordViewController *forgetVC = [[ForgetPassWordViewController alloc]init];
            [self.navigationController pushViewController:forgetVC animated:YES];
        }
            break;
        default:
            break;
    }
    
    
}






- (void)dealloc{
    
    NSLog(@"短信验证登录页面销毁");
}










@end














